import * as constants from './constants'
//List只能把数组的外层转换为Immutable数组,内层还是普通的对象，而fromJs则能全部转换为immutable类型；
import {fromJS,List} from "immutable";
import axios from 'axios';

const changeDetail=(data)=>({
    type:constants.CHANGE_DETAIL,
    data
});
export const getDetail=(id)=>{
    return (dispatch)=>{
        axios.get("/api/detail.json?id="+id).then((res)=>{
            const result=res.data.data;
            dispatch(changeDetail(result))
        }).catch((err)=>{
            console.log(err);
        })
    }
}
